#include "MephistoCAM.h"
// #include "MephistoCAM_socket.h"

int init_MephistoCAM_Config( MephistoCAM_Config *cfg, char *config_path ){

    char config_file_ccd_drive[1024];

    sprintf(config_file_ccd_drive, "%s/ccd_drv.ini", config_path);

    // CCD_DRV
    cfg->config_ccd_drive   = (ccd290_drive_config*)malloc(sizeof(ccd290_drive_config));
    load_ccd290_drive_config_params( config_file_ccd_drive, cfg->config_ccd_drive );
    cfg->n_row              = cfg->config_ccd_drive->vtrans_num;
    cfg->n_col              = cfg->config_ccd_drive->htrans_num;
    
    // CCD DCDS
    sprintf(cfg->dcds_config_file, "%s/dcds_weights_cfg.ini", config_path);
    cfg->n_bytes            = 2;   // default value

    cfg->gpio_flt_ctrl      = NULL;
    cfg->gpio_flt_data      = NULL;

    cfg->gpio_in            = NULL;
    cfg->gpio_pl_ps         = NULL;

    cfg->gpio_out           = NULL;
    cfg->gpio_out2          = NULL;

    cfg->gpio_spi_ps_ctrl   = NULL;
    cfg->gpio_spi_ps_data   = NULL;

    return 0;
}


int free_MephistoCAM_Config( MephistoCAM_Config *cfg ){

    free_ccd290_drive_config_params( cfg->config_ccd_drive );
    
    cfg = NULL;

    return 0;
}
